package com.cencat.product.vo;

import com.cencat.product.entity.Product;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 产品视图对象
 * 
 * @author cencat
 * @since 2024-01-01
 */
@Data
@Schema(description = "产品视图对象")
public class ProductVO {

    /**
     * 产品ID
     */
    @Schema(description = "产品ID")
    private Long id;

    /**
     * 产品编码
     */
    @Schema(description = "产品编码")
    private String productCode;

    /**
     * 产品名称
     */
    @Schema(description = "产品名称")
    private String productName;

    /**
     * 产品简称
     */
    @Schema(description = "产品简称")
    private String shortName;

    /**
     * 产品描述
     */
    @Schema(description = "产品描述")
    private String description;

    /**
     * 产品详情
     */
    @Schema(description = "产品详情")
    private String detail;

    /**
     * 产品分类信息
     */
    @Schema(description = "产品分类信息")
    private CategoryInfo categoryInfo;

    /**
     * 品牌信息
     */
    @Schema(description = "品牌信息")
    private BrandInfo brandInfo;

    /**
     * 商家信息
     */
    @Schema(description = "商家信息")
    private MerchantInfo merchantInfo;

    /**
     * 产品类型
     */
    @Schema(description = "产品类型")
    private Product.ProductType productType;

    /**
     * 产品类型描述
     */
    @Schema(description = "产品类型描述")
    private String productTypeDesc;

    /**
     * 产品状态
     */
    @Schema(description = "产品状态")
    private Product.ProductStatus status;

    /**
     * 产品状态描述
     */
    @Schema(description = "产品状态描述")
    private String statusDesc;

    /**
     * 销售价格
     */
    @Schema(description = "销售价格")
    private BigDecimal salePrice;

    /**
     * 市场价格
     */
    @Schema(description = "市场价格")
    private BigDecimal marketPrice;

    /**
     * 成本价格
     */
    @Schema(description = "成本价格")
    private BigDecimal costPrice;

    /**
     * 库存数量
     */
    @Schema(description = "库存数量")
    private Integer stockQuantity;

    /**
     * 预警库存
     */
    @Schema(description = "预警库存")
    private Integer warningStock;

    /**
     * 最小库存
     */
    @Schema(description = "最小库存")
    private Integer minStock;

    /**
     * 最大库存
     */
    @Schema(description = "最大库存")
    private Integer maxStock;

    /**
     * 库存状态
     */
    @Schema(description = "库存状态")
    private String stockStatus;

    /**
     * 产品重量（克）
     */
    @Schema(description = "产品重量（克）")
    private BigDecimal weight;

    /**
     * 产品体积（立方厘米）
     */
    @Schema(description = "产品体积（立方厘米）")
    private BigDecimal volume;

    /**
     * 产品尺寸
     */
    @Schema(description = "产品尺寸")
    private String dimensions;

    /**
     * 产品颜色
     */
    @Schema(description = "产品颜色")
    private String color;

    /**
     * 产品材质
     */
    @Schema(description = "产品材质")
    private String material;

    /**
     * 产品产地
     */
    @Schema(description = "产品产地")
    private String origin;

    /**
     * 保质期（天）
     */
    @Schema(description = "保质期（天）")
    private Integer shelfLife;

    /**
     * 生产日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Schema(description = "生产日期")
    private LocalDateTime productionDate;

    /**
     * 过期日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Schema(description = "过期日期")
    private LocalDateTime expiryDate;

    /**
     * 产品图片列表
     */
    @Schema(description = "产品图片列表")
    private List<ProductImageVO> images;

    /**
     * 产品视频列表
     */
    @Schema(description = "产品视频列表")
    private List<ProductVideoVO> videos;

    /**
     * 主图URL
     */
    @Schema(description = "主图URL")
    private String mainImageUrl;

    /**
     * 产品标签
     */
    @Schema(description = "产品标签")
    private String tags;

    /**
     * 产品标签列表
     */
    @Schema(description = "产品标签列表")
    private List<String> tagList;

    /**
     * 产品关键词
     */
    @Schema(description = "产品关键词")
    private String keywords;

    /**
     * 产品关键词列表
     */
    @Schema(description = "产品关键词列表")
    private List<String> keywordList;

    /**
     * SEO标题
     */
    @Schema(description = "SEO标题")
    private String seoTitle;

    /**
     * SEO描述
     */
    @Schema(description = "SEO描述")
    private String seoDescription;

    /**
     * SEO关键词
     */
    @Schema(description = "SEO关键词")
    private String seoKeywords;

    /**
     * 是否推荐
     */
    @Schema(description = "是否推荐")
    private Boolean isRecommended;

    /**
     * 是否热销
     */
    @Schema(description = "是否热销")
    private Boolean isHot;

    /**
     * 是否新品
     */
    @Schema(description = "是否新品")
    private Boolean isNew;

    /**
     * 是否特价
     */
    @Schema(description = "是否特价")
    private Boolean isSpecial;

    /**
     * 销售数量
     */
    @Schema(description = "销售数量")
    private Integer salesCount;

    /**
     * 浏览数量
     */
    @Schema(description = "浏览数量")
    private Integer viewCount;

    /**
     * 收藏数量
     */
    @Schema(description = "收藏数量")
    private Integer favoriteCount;

    /**
     * 评论数量
     */
    @Schema(description = "评论数量")
    private Integer commentCount;

    /**
     * 评分
     */
    @Schema(description = "评分")
    private BigDecimal rating;

    /**
     * 排序号
     */
    @Schema(description = "排序号")
    private Integer sortOrder;

    /**
     * 上架时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Schema(description = "上架时间")
    private LocalDateTime shelfTime;

    /**
     * 下架时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Schema(description = "下架时间")
    private LocalDateTime offShelfTime;

    /**
     * 审核状态
     */
    @Schema(description = "审核状态")
    private Product.AuditStatus auditStatus;

    /**
     * 审核状态描述
     */
    @Schema(description = "审核状态描述")
    private String auditStatusDesc;

    /**
     * 审核时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Schema(description = "审核时间")
    private LocalDateTime auditTime;

    /**
     * 审核人信息
     */
    @Schema(description = "审核人信息")
    private AuditorInfo auditorInfo;

    /**
     * 审核备注
     */
    @Schema(description = "审核备注")
    private String auditRemark;

    /**
     * 产品规格列表
     */
    @Schema(description = "产品规格列表")
    private List<ProductSpecVO> specifications;

    /**
     * 产品属性列表
     */
    @Schema(description = "产品属性列表")
    private List<ProductAttributeVO> attributes;

    /**
     * 扩展属性
     */
    @Schema(description = "扩展属性")
    private String extraAttributes;

    /**
     * 备注
     */
    @Schema(description = "备注")
    private String remark;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Schema(description = "创建时间")
    private LocalDateTime createTime;

    /**
     * 更新时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Schema(description = "更新时间")
    private LocalDateTime updateTime;

    /**
     * 创建人ID
     */
    @Schema(description = "创建人ID")
    private Long createBy;

    /**
     * 更新人ID
     */
    @Schema(description = "更新人ID")
    private Long updateBy;

    /**
     * 租户ID
     */
    @Schema(description = "租户ID")
    private Long tenantId;

    /**
     * 产品分类信息
     */
    @Data
    @Schema(description = "产品分类信息")
    public static class CategoryInfo {
        
        /**
         * 分类ID
         */
        @Schema(description = "分类ID")
        private Long id;
        
        /**
         * 分类名称
         */
        @Schema(description = "分类名称")
        private String name;
        
        /**
         * 分类编码
         */
        @Schema(description = "分类编码")
        private String code;
        
        /**
         * 分类路径
         */
        @Schema(description = "分类路径")
        private String path;
        
        /**
         * 父分类ID
         */
        @Schema(description = "父分类ID")
        private Long parentId;
        
        /**
         * 分类层级
         */
        @Schema(description = "分类层级")
        private Integer level;
    }

    /**
     * 品牌信息
     */
    @Data
    @Schema(description = "品牌信息")
    public static class BrandInfo {
        
        /**
         * 品牌ID
         */
        @Schema(description = "品牌ID")
        private Long id;
        
        /**
         * 品牌名称
         */
        @Schema(description = "品牌名称")
        private String name;
        
        /**
         * 品牌编码
         */
        @Schema(description = "品牌编码")
        private String code;
        
        /**
         * 品牌LOGO
         */
        @Schema(description = "品牌LOGO")
        private String logo;
        
        /**
         * 品牌描述
         */
        @Schema(description = "品牌描述")
        private String description;
    }

    /**
     * 商家信息
     */
    @Data
    @Schema(description = "商家信息")
    public static class MerchantInfo {
        
        /**
         * 商家ID
         */
        @Schema(description = "商家ID")
        private Long id;
        
        /**
         * 商家名称
         */
        @Schema(description = "商家名称")
        private String name;
        
        /**
         * 商家编码
         */
        @Schema(description = "商家编码")
        private String code;
        
        /**
         * 商家LOGO
         */
        @Schema(description = "商家LOGO")
        private String logo;
        
        /**
         * 联系电话
         */
        @Schema(description = "联系电话")
        private String phone;
        
        /**
         * 商家状态
         */
        @Schema(description = "商家状态")
        private String status;
    }

    /**
     * 审核人信息
     */
    @Data
    @Schema(description = "审核人信息")
    public static class AuditorInfo {
        
        /**
         * 审核人ID
         */
        @Schema(description = "审核人ID")
        private Long id;
        
        /**
         * 审核人姓名
         */
        @Schema(description = "审核人姓名")
        private String name;
        
        /**
         * 审核人用户名
         */
        @Schema(description = "审核人用户名")
        private String username;
    }

    /**
     * 产品图片VO
     */
    @Data
    @Schema(description = "产品图片VO")
    public static class ProductImageVO {
        
        /**
         * 图片ID
         */
        @Schema(description = "图片ID")
        private Long id;
        
        /**
         * 图片URL
         */
        @Schema(description = "图片URL")
        private String url;
        
        /**
         * 图片标题
         */
        @Schema(description = "图片标题")
        private String title;
        
        /**
         * 图片描述
         */
        @Schema(description = "图片描述")
        private String description;
        
        /**
         * 是否主图
         */
        @Schema(description = "是否主图")
        private Boolean isMain;
        
        /**
         * 排序号
         */
        @Schema(description = "排序号")
        private Integer sortOrder;
    }

    /**
     * 产品视频VO
     */
    @Data
    @Schema(description = "产品视频VO")
    public static class ProductVideoVO {
        
        /**
         * 视频ID
         */
        @Schema(description = "视频ID")
        private Long id;
        
        /**
         * 视频URL
         */
        @Schema(description = "视频URL")
        private String url;
        
        /**
         * 视频标题
         */
        @Schema(description = "视频标题")
        private String title;
        
        /**
         * 视频描述
         */
        @Schema(description = "视频描述")
        private String description;
        
        /**
         * 视频时长（秒）
         */
        @Schema(description = "视频时长（秒）")
        private Integer duration;
        
        /**
         * 视频封面
         */
        @Schema(description = "视频封面URL")
        private String coverUrl;
        
        /**
         * 排序号
         */
        @Schema(description = "排序号")
        private Integer sortOrder;
    }

    /**
     * 产品规格VO
     */
    @Data
    @Schema(description = "产品规格VO")
    public static class ProductSpecVO {
        
        /**
         * 规格ID
         */
        @Schema(description = "规格ID")
        private Long id;
        
        /**
         * 规格名称
         */
        @Schema(description = "规格名称")
        private String name;
        
        /**
         * 规格值
         */
        @Schema(description = "规格值")
        private String value;
        
        /**
         * 规格单位
         */
        @Schema(description = "规格单位")
        private String unit;
        
        /**
         * 排序号
         */
        @Schema(description = "排序号")
        private Integer sortOrder;
    }

    /**
     * 产品属性VO
     */
    @Data
    @Schema(description = "产品属性VO")
    public static class ProductAttributeVO {
        
        /**
         * 属性ID
         */
        @Schema(description = "属性ID")
        private Long id;
        
        /**
         * 属性名称
         */
        @Schema(description = "属性名称")
        private String name;
        
        /**
         * 属性值
         */
        @Schema(description = "属性值")
        private String value;
        
        /**
         * 属性类型
         */
        @Schema(description = "属性类型")
        private String type;
        
        /**
         * 是否必填
         */
        @Schema(description = "是否必填")
        private Boolean required;
        
        /**
         * 排序号
         */
        @Schema(description = "排序号")
        private Integer sortOrder;
    }

    /**
     * 产品统计VO
     */
    @Data
    @Schema(description = "产品统计VO")
    public static class ProductStatsVO {
        
        /**
         * 总数量
         */
        @Schema(description = "总数量")
        private Long totalCount;
        
        /**
         * 上架数量
         */
        @Schema(description = "上架数量")
        private Long onShelfCount;
        
        /**
         * 下架数量
         */
        @Schema(description = "下架数量")
        private Long offShelfCount;
        
        /**
         * 售罄数量
         */
        @Schema(description = "售罄数量")
        private Long soldOutCount;
        
        /**
         * 库存不足数量
         */
        @Schema(description = "库存不足数量")
        private Long lowStockCount;
        
        /**
         * 待审核数量
         */
        @Schema(description = "待审核数量")
        private Long pendingAuditCount;
        
        /**
         * 审核通过数量
         */
        @Schema(description = "审核通过数量")
        private Long approvedCount;
        
        /**
         * 审核拒绝数量
         */
        @Schema(description = "审核拒绝数量")
        private Long rejectedCount;
    }
}